//package com.hrm.interceptor;
//
//import org.springframework.web.servlet.HandlerInterceptor;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
///**
// * @Auther: zy
// * @Date: 2020/5/24 21:51
// * @Description:
// */
//public class AuthorityInterceptor implements HandlerInterceptor {
//    private final static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(AuthorityInterceptor.class);
//
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        if (userService.ifUserIsAdmin(request.getSession())) {
//            logger.info("管理员访问:" + request.getRequestURI());
//            return true;
//        }
//        logger.info("非管理员访问:" + request.getRequestURI() + " 无操作权限");
//        httpServletResponse.sendRedirect(request.getContextPath() + "/main/toError.html");
//        return false;
//    }
//
//    @Override
//    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
//
//    }
//
//    @Override
//    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//
//    }
//}
